defdecode_block(r_x): S = [PR(r_x)(alpha^i) for i inrange(4)] nu = 2 A = matrix(F,nu,nu) for i inrange(nu): for j inrange(nu): A[i,j] = S[i+j] b = vector(F,[-S[nu+i] for i inrange(nu)]) x = list(A.solve_right(b)) x.append(1) x.reverse() Lambda = PR(x) I = [] for i inrange(8): if Lambda(alpha^(-i))==0: I.append(i) I = I + [0] * (2 - len(I)) X = [alpha^I[i] for i inrange(2)] A = matrix(F,2,2) for i inrange(2): for j inrange(2): A[i,j] = X[j]^i b = list(A.solve_right(vector(F,S[:2]))) for i inrange(len(I)): r_x[I[i]] -= b[i] return r_x[4:]